phylo4, phylo4d or data.frame object
from a NEXUS or a Newick filereadNexus reads a NEXUS file and outputs a phylo4,
phylo4d or data.frame object.
readNCL(file, simplify = FALSE, type = c("all", "tree", "data"), spacesAsUnderscores = TRUE, char.all = FALSE, polymorphic.convert = TRUE, levels.uniform = FALSE, quiet = TRUE, check.node.labels = c("keep", "drop", "asdata"), return.labels = TRUE, file.format = c("nexus", "newick"), check.names = TRUE, convert.edge.length = FALSE, ...)
readNexus(file, simplify = FALSE, type = c("all", "tree", "data"), char.all = FALSE, polymorphic.convert = TRUE, levels.uniform = FALSE, quiet = TRUE, check.node.labels = c("keep", "drop", "asdata"), return.labels = TRUE, check.names = TRUE, convert.edge.length = FALSE, ...)
readNewick(file, simplify = FALSE, quiet = TRUE, check.node.labels = c("keep", "drop", "asdata"), convert.edge.length = FALSE, ...)readNexus or a file that
contains Newick formatted trees for readNewick.phylo4(d) objects is returned if the file contains multiple
trees.species_1 will become "species 1". If you
want to preserve the underscores, set as TRUE, the default).TRUE, returns all characters, even those
excluded in the NEXUS fileTRUE, converts polymorphic
characters to missing dataTRUE, uses the same levels for all
charactersFALSE the output of the NCL interface is
printed. This is mainly for debugging purposes. This option
can considerably slow down the process if the tree is big or
there are many trees in the file.TRUE) or state codes should be returned.newick or
nexus). It's more convenient to just use
readNexus or readNewick.TRUE negative edge
lengths are replaced with 0. At this time phylobase
does not accept objects with negative branch lengths, this
workaround allows to import trees with negative branch
lengths.type and the contents of
the file, one of: a data.frame, a phylo4
object, a phylo4d object or NULL. If
several trees are included in the NEXUS file and the option
simplify=FALSE a list of phylo4 or
phylo4d objects is returned.
readNewick reads a Newick file and outputs a phylo4
or phylo4d object.readNexus is used internally by both readNexus and
readNewick to extract data held in a tree files,
specifically in NEXUS files from DATA, CHARACTER or TREES
blocks.
The type argument specifies which of these is returned:
data.frame of the contents
of all DATA and CHARACTER blocks.
phylo4 object of the
contents of the TREES block.
data.frame or a phylo4 object respectively. If both
are present then a phylo4d object is returned containing
both.
The function returns NULL if the type of
data requested is not present in the file, or if neither data nor
tree blocks are present.
Depending on the context readNexus will call either the
phylo4 or phylo4d constructor. The phylo4d
constructor will be used with type="all", or if the option
check.node.labels="asdata" is invoked.
readNewick imports Newick formatted tree files and will
return a phylo4 or a phylo4d object if the option
check.node.labels="asdata" is invoked.
For both readNexus and readNewick, the options for
check.node.labels can take the values:
phylo4 object
phylo4 object
phylo4d object will be returned.
If you use the option asdata on a file with no node labels,
a warning message is issued, and is thus equivalent to the value
drop.
For both readNexus and readNewick, additional
arguments can be passed to the constructors such as annote,
missing.data or extra.data. See the Details
section of phylo4d-methods for the complete list of
options.